Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc layout improvements in dataset upload #8231

Merged
merged 8 commits into from
Dec 2, 2024
Merged

Conversation

philippotto
Copy link
Member

@philippotto philippotto commented Nov 26, 2024

The toasts were redundant because the popover showed the same information. I also fixed the layout in the upload modals (as well as one in the "this dataset does not exist" screen).

Best viewed with "Hide whitespace".

URL of deployed dev instance (used for testing):

  • https://___.webknossos.xyz

Steps to test:

I checked the following scenarios (ignore the theme change):

before:
image

after:
image

before:
image

after:
image

Issues:


@philippotto philippotto self-assigned this Nov 26, 2024
Copy link
Contributor

coderabbitai bot commented Nov 26, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The pull request introduces several user-facing changes to the WEBKNOSSOS application, including enhancements to error messages, improvements in the dataset upload process, and restructuring of UI components for better clarity. Key updates include the transition to asynchronous image file reading, removal of bounding box restrictions for super users, and various bug fixes. Additionally, the changelog has been updated to reflect these changes, and Google Analytics integration has been removed.

Changes

File Path Change Summary
CHANGELOG.unreleased.md Updated to reflect user-facing changes, including URI pasting, asynchronous file reading, improved error messages, and bug fixes.
frontend/javascripts/admin/dataset/dataset_add_view.tsx Added centered-items class, streamlined button layout, and adjusted margin styles in DatasetAddView.
frontend/javascripts/admin/dataset/dataset_upload_view.tsx Improved error handling and user feedback in dataset upload process, refined success/error messages, and enhanced file validation.
frontend/javascripts/components/brain_spinner.tsx Restructured JSX layout in BrainSpinnerWithError for better visual alignment of button and link.
frontend/javascripts/messages.tsx Expanded constants for settings and tooltips, added new configuration options, and introduced RecommendedConfiguration type.

Possibly related PRs

Suggested labels

enhancement, bug

Suggested reviewers

  • dieknolle3333
  • MichaelBuessemeyer

Poem

🐇 In the meadow where we play,
Changes come to light today.
Buttons align, messages clear,
A hop, a skip, let's give a cheer!
With every fix, our joy will grow,
In WEBKNOSSOS, watch us glow! ✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@philippotto philippotto marked this pull request as ready for review November 26, 2024 13:26
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (5)
CHANGELOG.unreleased.md (1)

22-22: Consider rephrasing for clarity and conciseness.

The phrase "a lot of" could be replaced with a more precise term:

-Fixed performance bottleneck when deleting a lot of trees at once. [#8176](https://github.com/scalableminds/webknossos/pull/8176)
+Fixed performance bottleneck when deleting multiple trees at once. [#8176](https://github.com/scalableminds/webknossos/pull/8176)
🧰 Tools
🪛 LanguageTool

[style] ~22-~22: The phrase ‘a lot of’ might be wordy and overused. Consider using an alternative.
Context: ...ed performance bottleneck when deleting a lot of trees at once. [#8176](https://github.c...

(A_LOT_OF)

frontend/javascripts/components/brain_spinner.tsx (1)

81-92: LGTM! Consider refining the spacing styles

The new layout structure using flex-center-child with gap spacing improves the alignment and spacing between the organization switch button and dashboard link. This aligns well with the PR's objective of enhancing UI layouts.

Consider removing the marginTop style from the Link component since spacing is now handled by the parent's gap property:

  <Link
    to="/"
-   style={{
-     marginTop: 16,
-   }}
  >
frontend/javascripts/admin/dataset/dataset_add_view.tsx (1)

314-334: Consider standardizing button spacing.

While the button layout is good, consider using a design system constant for consistent spacing between buttons across modals.

Example enhancement:

 <React.Fragment>
   <Button
     type="primary"
+    style={{ marginRight: 8 }}  // Use your design system spacing constant
     onClick={() => history.push(`/datasets/${organization}/${datasetName}/view`)}
   >
     View the Dataset
   </Button>
   <Button
+    style={{ marginRight: 8 }}  // Use your design system spacing constant
     onClick={() => history.push(`/datasets/${organization}/${datasetName}/edit`)}
   >
     Go to Dataset Settings
   </Button>
   <Button onClick={() => history.push("/dashboard/datasets")}>
     Go to Dashboard
   </Button>
 </React.Fragment>
frontend/javascripts/admin/dataset/dataset_upload_view.tsx (2)

371-373: Enhance error message with more context

Consider improving the error message by including the dataset name and error details for better debugging:

 if (maybeError != null) {
   Toast.error(
-    "The upload was successful, but the conversion for the dataset could not be started. Please try again or contact us if this issue occurs again.",
+    `The upload was successful, but the conversion for dataset "${formValues.name}" could not be started. Error: ${maybeError.message}. Please try again or contact us if this issue occurs again.`
   );
 }

Line range hint 493-520: Move inline styles to CSS classes

The layout improvements look good, but consider moving the inline styles to CSS classes for better maintainability and reusability:

-<Spin spinning={isFinishing} style={{ marginTop: 4 }} tip="Processing uploaded files …">
+<Spin spinning={isFinishing} className="dataset-upload-spinner" tip="Processing uploaded files …">
   <div
-    style={{
-      display: "flex",
-      alignItems: "center",
-      flexDirection: "column",
-    }}
+    className="dataset-upload-content"
   >

Add these CSS classes to your stylesheet:

.dataset-upload-spinner {
  margin-top: 4px;
}

.dataset-upload-content {
  display: flex;
  align-items: center;
  flex-direction: column;
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between bf6ea15 and 99c1669.

📒 Files selected for processing (5)
  • CHANGELOG.unreleased.md (1 hunks)
  • frontend/javascripts/admin/dataset/dataset_add_view.tsx (1 hunks)
  • frontend/javascripts/admin/dataset/dataset_upload_view.tsx (3 hunks)
  • frontend/javascripts/components/brain_spinner.tsx (1 hunks)
  • frontend/javascripts/messages.tsx (0 hunks)
💤 Files with no reviewable changes (1)
  • frontend/javascripts/messages.tsx
🧰 Additional context used
🪛 LanguageTool
CHANGELOG.unreleased.md

[style] ~22-~22: The phrase ‘a lot of’ might be wordy and overused. Consider using an alternative.
Context: ...ed performance bottleneck when deleting a lot of trees at once. [#8176](https://github.c...

(A_LOT_OF)

🔇 Additional comments (1)
frontend/javascripts/admin/dataset/dataset_add_view.tsx (1)

309-311: LGTM! Verify the centered-items class.

The switch to using a dedicated CSS class for centering improves maintainability and consistency.

Let's verify the existence and implementation of the centered-items class:

✅ Verification successful

The centered-items class is properly implemented and safe to use

The class is defined in _utils.less with appropriate flex properties for centering items horizontally:

  • Uses display: flex with flex-direction: row
  • Centers content with justify-content: center
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for the centered-items class definition and usage
rg "centered-items" --type css
rg "centered-items" --type less
rg "centered-items" --type scss

Length of output: 323


Script:

#!/bin/bash
# Let's check the implementation of centered-items class in _utils.less
cat frontend/stylesheets/_utils.less | grep -A 5 "centered-items"

# Also check if this class is imported/used in the dataset view's style dependencies
rg -l "_utils\.less" frontend/javascripts/admin/dataset/

Length of output: 220

CHANGELOG.unreleased.md Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
CHANGELOG.unreleased.md (1)

22-22: Consider using more precise wording.

Replace "a lot of" with a more specific phrase for better clarity.

-Fixed performance bottleneck when deleting a lot of trees at once.
+Fixed performance bottleneck when deleting multiple trees simultaneously.
🧰 Tools
🪛 LanguageTool

[style] ~22-~22: The phrase ‘a lot of’ might be wordy and overused. Consider using an alternative.
Context: ...ed performance bottleneck when deleting a lot of trees at once. [#8176](https://github.c...

(A_LOT_OF)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 99c1669 and 4e79d4b.

📒 Files selected for processing (1)
  • CHANGELOG.unreleased.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
CHANGELOG.unreleased.md

[style] ~22-~22: The phrase ‘a lot of’ might be wordy and overused. Consider using an alternative.
Context: ...ed performance bottleneck when deleting a lot of trees at once. [#8176](https://github.c...

(A_LOT_OF)

🔇 Additional comments (1)
CHANGELOG.unreleased.md (1)

27-27: Previous review comment is still applicable.

Copy link
Member

@hotzenklotz hotzenklotz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Changes LGTM. Will do some testing now.

@hotzenklotz
Copy link
Member

When testing I noticed two issues:

  1. The upload progress bar always starts at 100% before "quickly" jumping to 0%. I assume the some default values is either wrong or missing entirely.
  2. After the upload succeeded a spinner "Processing uploaded files" is shown. The spinner, however, is overlaid over the progress bar and hardly visible. See screenshot.
Screenshot 2024-11-28 at 13 35 28 Screenshot 2024-11-28 at 13 32 49

@philippotto
Copy link
Member Author

@hotzenklotz Thanks for catching these things! I could reproduce the progress=100 thingie when uploading another dataset after a first DS was uploaded. For the very first DS, it already worked for me. I pushed a fix for the non-first DS.

For your other point, I changed the layout so that the two phases look like this now:

image
image
(it's an animated spinner)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
CHANGELOG.unreleased.md (1)

27-27: Consider rephrasing for clarity and conciseness.

Replace "a lot of" with a more precise phrase.

-Fixed performance bottleneck when deleting a lot of trees at once.
+Fixed performance bottleneck when deleting multiple trees simultaneously.
🧰 Tools
🪛 LanguageTool

[style] ~27-~27: The phrase ‘a lot of’ might be wordy and overused. Consider using an alternative.
Context: ...ed performance bottleneck when deleting a lot of trees at once. [#8176](https://github.c...

(A_LOT_OF)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 4e79d4b and 023b628.

📒 Files selected for processing (4)
  • CHANGELOG.unreleased.md (1 hunks)
  • frontend/javascripts/admin/dataset/dataset_add_view.tsx (1 hunks)
  • frontend/javascripts/admin/dataset/dataset_upload_view.tsx (4 hunks)
  • frontend/javascripts/messages.tsx (0 hunks)
💤 Files with no reviewable changes (1)
  • frontend/javascripts/messages.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • frontend/javascripts/admin/dataset/dataset_add_view.tsx
  • frontend/javascripts/admin/dataset/dataset_upload_view.tsx
🧰 Additional context used
🪛 LanguageTool
CHANGELOG.unreleased.md

[style] ~27-~27: The phrase ‘a lot of’ might be wordy and overused. Consider using an alternative.
Context: ...ed performance bottleneck when deleting a lot of trees at once. [#8176](https://github.c...

(A_LOT_OF)

🔇 Additional comments (1)
CHANGELOG.unreleased.md (1)

35-35: Enhance the changelog entry with more specific details.

The current entry is too vague and should reflect the specific improvements mentioned in the PR objectives, including the upload progress bar and spinner visibility issues reported in the PR comments.

-Fixed some layout issues in the upload view. [#8231](https://github.com/scalableminds/webknossos/pull/8231)
+Fixed layout issues in the dataset upload view: removed redundant toasts, improved upload modal layout, enhanced the "dataset does not exist" screen, and fixed upload progress bar and spinner visibility issues. [#8231](https://github.com/scalableminds/webknossos/pull/8231)

Copy link
Member

@hotzenklotz hotzenklotz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@philippotto philippotto enabled auto-merge (squash) December 2, 2024 12:41
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
CHANGELOG.unreleased.md (1)

28-28: Consider using more precise language.

The phrase "a lot of" is imprecise. Consider using more specific wording to better convey the impact of this fix.

-Fixed performance bottleneck when deleting a lot of trees at once.
+Fixed performance bottleneck when deleting multiple trees simultaneously.
🧰 Tools
🪛 LanguageTool

[style] ~28-~28: The phrase ‘a lot of’ might be wordy and overused. Consider using an alternative.
Context: ...ed performance bottleneck when deleting a lot of trees at once. [#8176](https://github.c...

(A_LOT_OF)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 023b628 and 18097ce.

📒 Files selected for processing (1)
  • CHANGELOG.unreleased.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
CHANGELOG.unreleased.md

[style] ~28-~28: The phrase ‘a lot of’ might be wordy and overused. Consider using an alternative.
Context: ...ed performance bottleneck when deleting a lot of trees at once. [#8176](https://github.c...

(A_LOT_OF)

🔇 Additional comments (1)
CHANGELOG.unreleased.md (1)

36-36: Enhance the changelog entry with more specific details.

The current entry is too vague and doesn't capture the full scope of the improvements made in PR #8231.

-Fixed some layout issues in the upload view. [#8231](https://github.com/scalableminds/webknossos/pull/8231)
+Fixed layout issues in the dataset upload view: removed redundant toasts, improved upload modal layout, and enhanced the "dataset does not exist" screen. [#8231](https://github.com/scalableminds/webknossos/pull/8231)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants